<!doctype html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="学习笔记," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="前言阿里云上使用Ngnix部署了一个静态项目，想通过FTP来管理这个静态项目。搭建前先去了解了一下FTP，FTP是文件传输协议，用于Internet上的控制文件的双向传输，实现服务端和客户端的文件上传和下载。阿里云线上环境是Centos7，这里使用vsftpd来搭建FTP服务。">
<meta property="og:type" content="article">
<meta property="og:title" content="Centos7搭建FTP服务器">
<meta property="og:url" content="http://jieminblog.tk/2017/03/24/Centos7搭建FTP服务器/index.html">
<meta property="og:site_name" content="jiemin's Blog">
<meta property="og:description" content="前言阿里云上使用Ngnix部署了一个静态项目，想通过FTP来管理这个静态项目。搭建前先去了解了一下FTP，FTP是文件传输协议，用于Internet上的控制文件的双向传输，实现服务端和客户端的文件上传和下载。阿里云线上环境是Centos7，这里使用vsftpd来搭建FTP服务。">
<meta property="og:image" content="http://omdsjtsd2.bkt.clouddn.com/17-3-24/52019284-file_1490339902734_12c78.png">
<meta property="og:updated_time" content="2017-03-25T07:26:47.063Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Centos7搭建FTP服务器">
<meta name="twitter:description" content="前言阿里云上使用Ngnix部署了一个静态项目，想通过FTP来管理这个静态项目。搭建前先去了解了一下FTP，FTP是文件传输协议，用于Internet上的控制文件的双向传输，实现服务端和客户端的文件上传和下载。阿里云线上环境是Centos7，这里使用vsftpd来搭建FTP服务。">
<meta name="twitter:image" content="http://omdsjtsd2.bkt.clouddn.com/17-3-24/52019284-file_1490339902734_12c78.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://jieminblog.tk/2017/03/24/Centos7搭建FTP服务器/"/>





  <title> Centos7搭建FTP服务器 | jiemin's Blog </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  














  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">jiemin's Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">本来无一物，何处惹尘埃</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://jieminblog.tk/2017/03/24/Centos7搭建FTP服务器/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="我爱的乌托邦">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/uploads/touxiang.jpeg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="jiemin's Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                Centos7搭建FTP服务器
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-03-24T15:50:46+08:00">
                2017-03-24
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>阿里云上使用Ngnix部署了一个静态项目，想通过FTP来管理这个静态项目。搭建前先去了解了一下FTP，FTP是文件传输协议，用于Internet上的控制文件的双向传输，实现服务端和客户端的文件上传和下载。阿里云线上环境是Centos7，这里使用vsftpd来搭建FTP服务。<br><a id="more"></a></p>
<h1 id="安装过程"><a href="#安装过程" class="headerlink" title="安装过程"></a>安装过程</h1><h2 id="安装vsftpd的服务器及相关软件"><a href="#安装vsftpd的服务器及相关软件" class="headerlink" title="安装vsftpd的服务器及相关软件"></a>安装vsftpd的服务器及相关软件</h2><p>安装vsftpd服务器和客户端 </p>
<p><code>yum install ftp vsftpd</code></p>
<p>安装加密工具</p>
<p><code>yum install libdb-utils.x86_64</code></p>
<h2 id="配置vsftpd"><a href="#配置vsftpd" class="headerlink" title="配置vsftpd"></a>配置vsftpd</h2><p>创建vsftpd的登录用户和主目录 </p>
<p><code>useradd -s /sbin/nologin znuser</code></p>
<p>修改密码</p>
<p><code>passwd znuser</code></p>
<p>创建vsftpd虚拟用户</p>
<figure class="highlight stylus"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">vi /etc/vsftpd/vftpuser<span class="selector-class">.txt</span></div><div class="line"></div><div class="line">www</div><div class="line"><span class="number">123456</span></div></pre></td></tr></table></figure>
<p>hash加密</p>
<p><code>db_load -T -t hash -f /etc/vsftpd/vftpuser.txt      /etc/vsftpd/vftpuser.db</code> </p>
<p>添加vsftpd的虚拟用户验证</p>
<p><code>vi /etc/pam.d/vsftpd</code></p>
<p>把auth和account替换</p>
<figure class="highlight stylus"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">session    optional     pam_keyinit<span class="selector-class">.so</span>    force revoke</div><div class="line"><span class="selector-id">#auth</span>       required    pam_listfile<span class="selector-class">.so</span> item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed</div><div class="line"><span class="selector-id">#auth</span>       required    pam_shells<span class="selector-class">.so</span></div><div class="line"><span class="selector-id">#auth</span>       include     password-auth</div><div class="line"><span class="number">#acc</span>ount    include     password-auth</div><div class="line">auth required pam_userdb<span class="selector-class">.so</span> db=/etc/vsftpd/vftpuser</div><div class="line">account required pam_userdb<span class="selector-class">.so</span> db=/etc/vsftpd/vftpuser</div><div class="line">session    required     pam_loginuid<span class="selector-class">.so</span></div><div class="line">session    include      password-auth</div></pre></td></tr></table></figure>
<p>修改vsftpd的配置文件vsftpd.conf </p>
<p><code>vi /etc/vsftpd/vsftpd.conf</code></p>
<p>修改以下内容</p>
<figure class="highlight vala"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div></pre></td><td class="code"><pre><div class="line"><span class="meta"># 是否运行匿名登录（NO）</span></div><div class="line">anonymous_enable=NO</div><div class="line"><span class="meta"># 是否允许本地用户登录</span></div><div class="line">local_enable=YES</div><div class="line"><span class="meta"># 允许ftp的任何写方式</span></div><div class="line">write_enable=YES</div><div class="line"><span class="meta"># 文件创建只有的权限是755=（777-022）</span></div><div class="line">local_umask=<span class="number">022</span></div><div class="line"><span class="meta"># 是否允许匿名用户上传文件</span></div><div class="line"><span class="meta">#anon_upload_enable=YES</span></div><div class="line"><span class="meta"># 是否允许匿名用户创建文件或者删除文件</span></div><div class="line"><span class="meta">#anon_mkdir_write_enable=YES</span></div><div class="line"><span class="meta"># 用户进入目录信息提示</span></div><div class="line">dirmessage_enable=YES</div><div class="line"><span class="meta"># 是否允许vsftp的日志</span></div><div class="line">xferlog_enable=YES</div><div class="line"><span class="meta"># Make sure PORT transfer connections originate from port 20 (ftp-data).</span></div><div class="line">connect_from_port_20=YES</div><div class="line"><span class="meta">#</span></div><div class="line"><span class="meta">#chown_uploads=YES</span></div><div class="line"><span class="meta">#chown_username=whoever</span></div><div class="line"><span class="meta"># 日志文件的路径</span></div><div class="line">xferlog_file=/<span class="keyword">var</span>/log/xferlog</div><div class="line"><span class="meta"># 日志文件的格式</span></div><div class="line">xferlog_std_format=YES</div><div class="line"><span class="meta">#</span></div><div class="line"><span class="meta">#idle_session_timeout=600</span></div><div class="line"><span class="meta">#</span></div><div class="line"><span class="meta">#data_connection_timeout=120</span></div><div class="line"><span class="meta">#</span></div><div class="line"><span class="meta"># It is recommended that you define on your system a unique user which the</span></div><div class="line"><span class="meta"># ftp server can use as a totally isolated and unprivileged user.</span></div><div class="line"><span class="meta">#nopriv_user=ftpsecure</span></div><div class="line"><span class="meta">#</span></div><div class="line"><span class="meta"># Enable this and the server will recognise asynchronous ABOR requests. Not</span></div><div class="line"><span class="meta"># recommended for security (the code is non-trivial). Not enabling it,</span></div><div class="line"><span class="meta"># however, may confuse older FTP clients.</span></div><div class="line"><span class="meta">#async_abor_enable=YES</span></div><div class="line"><span class="meta">#</span></div><div class="line"><span class="meta"># By default the server will pretend to allow ASCII mode but in fact ignore</span></div><div class="line"><span class="meta"># the request. Turn on the below options to have the server actually do ASCII</span></div><div class="line"><span class="meta"># mangling on files when in ASCII mode.</span></div><div class="line"><span class="meta"># Beware that on some FTP servers, ASCII support allows a denial of service</span></div><div class="line"><span class="meta"># attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd</span></div><div class="line"><span class="meta"># predicted this attack and has always been safe, reporting the size of the</span></div><div class="line"><span class="meta"># raw file.</span></div><div class="line"><span class="meta"># ASCII mangling is a horrible feature of the protocol.</span></div><div class="line"><span class="meta">#ascii_upload_enable=YES</span></div><div class="line"><span class="meta">#ascii_download_enable=YES</span></div><div class="line"><span class="meta">#</span></div><div class="line"><span class="meta"># You may fully customise the login banner string:</span></div><div class="line"><span class="meta">#ftpd_banner=Welcome to blah FTP service.</span></div><div class="line"><span class="meta">#</span></div><div class="line"><span class="meta"># You may specify a file of disallowed anonymous e-mail addresses. Apparently</span></div><div class="line"><span class="meta"># useful for combatting certain DoS attacks.</span></div><div class="line"><span class="meta">#deny_email_enable=YES</span></div><div class="line"><span class="meta"># (default follows)</span></div><div class="line"><span class="meta">#banned_email_file=/etc/vsftpd/banned_emails</span></div><div class="line"><span class="meta">#</span></div><div class="line"><span class="meta"># You may specify an explicit list of local users to chroot() to their home</span></div><div class="line"><span class="meta"># directory. If chroot_local_user is YES, then this list becomes a list of</span></div><div class="line"><span class="meta"># users to NOT chroot().</span></div><div class="line"><span class="meta"># (Warning! chroot'ing can be very dangerous. If using chroot, make sure that</span></div><div class="line"><span class="meta"># the user does not have write access to the top level directory within the</span></div><div class="line"><span class="meta"># chroot)</span></div><div class="line">chroot_local_user=YES</div><div class="line">chroot_list_enable=YES</div><div class="line"><span class="meta"># (default follows)</span></div><div class="line"><span class="meta">#chroot_list_file=/etc/vsftpd/chroot_list</span></div><div class="line"><span class="meta">#</span></div><div class="line"><span class="meta"># You may activate the "-R" option to the builtin ls. This is disabled by</span></div><div class="line"><span class="meta"># default to avoid remote users being able to cause excessive I/O on large</span></div><div class="line"><span class="meta"># sites. However, some broken FTP clients such as "ncftp" and "mirror" assume</span></div><div class="line"><span class="meta"># the presence of the "-R" option, so there is a strong case for enabling it.</span></div><div class="line"><span class="meta">#ls_recurse_enable=YES</span></div><div class="line"><span class="meta">#</span></div><div class="line"><span class="meta"># When "listen" directive is enabled, vsftpd runs in standalone mode and</span></div><div class="line"><span class="meta"># listens on IPv4 sockets. This directive cannot be used in conjunction</span></div><div class="line"><span class="meta"># with the listen_ipv6 directive.</span></div><div class="line"><span class="meta"># 只监听ipv4的地址</span></div><div class="line">listen=YES</div><div class="line"><span class="meta">#</span></div><div class="line"><span class="meta"># This directive enables listening on IPv6 sockets. By default, listening</span></div><div class="line"><span class="meta"># on the IPv6 "any" address (::) will accept connections from both IPv6</span></div><div class="line"><span class="meta"># and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6</span></div><div class="line"><span class="meta"># sockets. If you want that (perhaps because you want to listen on specific</span></div><div class="line"><span class="meta"># addresses) then you must run two copies of vsftpd with two configuration</span></div><div class="line"><span class="meta"># files.</span></div><div class="line"><span class="meta"># Make sure, that one of the listen options is commented !!</span></div><div class="line"><span class="meta">#listen_ipv6=YES</span></div><div class="line"></div><div class="line">pam_service_name=vsftpd</div><div class="line">userlist_enable=YES</div><div class="line">tcp_wrappers=YES</div><div class="line"></div><div class="line"><span class="meta"># 下面是自己添加的</span></div><div class="line">virtual_use_local_privs=YES</div><div class="line">guest_enable=YES</div><div class="line">guest_username=znuser</div><div class="line"><span class="meta"># 虚拟用户的配置文件（可以对每一个虚拟用户进行单独的权限配置）</span></div><div class="line">user_config_dir=/etc/vsftpd/vconf/</div><div class="line">chroot_local_user=YES</div><div class="line">allow_writeable_chroot=YES</div><div class="line">启用pasv模式</div><div class="line">pasv_enable=YES    </div><div class="line"></div><div class="line"><span class="meta">#启用被动模式</span></div><div class="line">pasv_min_port=<span class="number">10060</span>     #被动模式使用端口范围</div><div class="line">pasv_max_port=<span class="number">10090</span>     #被动模式使用端口范围</div></pre></td></tr></table></figure>
<p>创建虚拟用户的权限配置 </p>
<figure class="highlight coffeescript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">mkdir <span class="regexp">/etc/vsftpd/vconf/</span></div><div class="line">cd <span class="regexp">/etc/vsftpd/vconf/</span></div><div class="line">vi www</div><div class="line"></div><div class="line">local_root=<span class="regexp">/home/znuser/www/</span></div><div class="line">write_enable=<span class="literal">yes</span></div><div class="line">download_enable=<span class="literal">yes</span></div><div class="line">anon_upload_enable=<span class="literal">yes</span></div><div class="line">anon_mkdir_write_enable=<span class="literal">yes</span></div><div class="line">anon_other_write_enable=<span class="literal">yes</span></div><div class="line">anon_world_readable_only=<span class="literal">no</span></div></pre></td></tr></table></figure>
<h2 id="配置防火墙"><a href="#配置防火墙" class="headerlink" title="配置防火墙"></a>配置防火墙</h2><p><code>vi /etc/sysconfig/iptables</code></p>
<p>新增以下内容</p>
<figure class="highlight pf"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">-A INPUT -p tcp -m <span class="keyword">state</span> --state NEW -m tcp --dport <span class="number">20</span> -j ACCEPT</div><div class="line">-A INPUT -p tcp -m <span class="keyword">state</span> --state NEW -m tcp --dport <span class="number">21</span> -j ACCEPT</div><div class="line">-A INPUT -p tcp -m <span class="keyword">state</span> --state NEW -m tcp --dport <span class="number">10060</span>:<span class="number">10090</span> -j ACCEPT</div></pre></td></tr></table></figure>
<h2 id="启动vsftpd服务"><a href="#启动vsftpd服务" class="headerlink" title="启动vsftpd服务"></a>启动vsftpd服务</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">systemctl <span class="built_in">enable</span> vsftpd</div><div class="line">systemctl start  vsftpd</div></pre></td></tr></table></figure>
<p>如果启动失败，查看日志</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">tail <span class="_">-f</span> /var/<span class="built_in">log</span>/secure</div></pre></td></tr></table></figure>
<p>本地测试能否登录，如下图显示成功</p>
<p><img src="http://omdsjtsd2.bkt.clouddn.com/17-3-24/52019284-file_1490339902734_12c78.png" alt=""></p>
<h1 id="搭建中遇到的问题"><a href="#搭建中遇到的问题" class="headerlink" title="搭建中遇到的问题"></a>搭建中遇到的问题</h1><h2 id="530-login-incorrect"><a href="#530-login-incorrect" class="headerlink" title="530 login incorrect"></a>530 login incorrect</h2><p>搭建中碰到的唯一的一个问题，花了不少时间才解决。首先检查了用户名密码是否正确，确认正确以后尝试了各种网上碰到这个错误的解决办法还是不行。查看日志里面有这么一段话<code>Unregistered Authentication Agent for unix-process:11386:896659 (system bus name :1.69, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale zh_CN.UTF-8) (disconnected from bus)</code>，尝试了网上提供的解决办法还是没用。最后删除了vsftp重新安装，安装的过程中发现了原因。第一次安装在创建vsftpd虚拟用户的时创建的是<code>vftpuser</code>，而在<code>/etc/pam.d/vsftpd</code>中有那么一段：<br><figure class="highlight crystal"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">db=<span class="regexp">/etc/vsftpd</span><span class="regexp">/vftpuser</span></div><div class="line">account required pam_userdb.so db=/etc<span class="regexp">/vsftpd/vftpuser</span></div></pre></td></tr></table></figure></p>
<p>这里的vftpuser冲突了，所以一直验证失败，将创建的文件改为vftpuser.txt即可解决。</p>
<h1 id="后记"><a href="#后记" class="headerlink" title="后记"></a>后记</h1><p>安装好FTP以后就把静态项目放到了虚拟用户目录之下，我这里的路径是<code>/home/znuser/www</code>，然后使用Ngnix将项目路径配置为虚拟用户目录，将静态项目发布出去。如果静态项目需要修改，就可以通过ftp客户端连接到服务器，更新内容。这比直接用ssh连接服务器更加安全，通过ftp客户端登录的人只能访问静态项目的目录，不会对服务器其他地方造成误操作。通过ftp服务可以更好的管理整个服务器。</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>


    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/学习笔记/" rel="tag"># 学习笔记</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/03/19/Centos7安装Mysql5-7笔记/" rel="next" title="Centos7安装Mysql5.7笔记">
                <i class="fa fa-chevron-left"></i> Centos7安装Mysql5.7笔记
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/03/25/windows2016server部署中普审计软件服务端/" rel="prev" title="windows2016server部署中普审计软件服务端">
                windows2016server部署中普审计软件服务端 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>

          
          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/uploads/touxiang.jpeg"
               alt="我爱的乌托邦" />
          <p class="site-author-name" itemprop="name">我爱的乌托邦</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">17</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">15</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#前言"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#安装过程"><span class="nav-number">2.</span> <span class="nav-text">安装过程</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#安装vsftpd的服务器及相关软件"><span class="nav-number">2.1.</span> <span class="nav-text">安装vsftpd的服务器及相关软件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配置vsftpd"><span class="nav-number">2.2.</span> <span class="nav-text">配置vsftpd</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配置防火墙"><span class="nav-number">2.3.</span> <span class="nav-text">配置防火墙</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#启动vsftpd服务"><span class="nav-number">2.4.</span> <span class="nav-text">启动vsftpd服务</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#搭建中遇到的问题"><span class="nav-number">3.</span> <span class="nav-text">搭建中遇到的问题</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#530-login-incorrect"><span class="nav-number">3.1.</span> <span class="nav-text">530 login incorrect</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#后记"><span class="nav-number">4.</span> <span class="nav-text">后记</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">我爱的乌托邦</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    
    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  




  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.0"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  



  




	





  





  





  



  
  

  

  

  

  


  

</body>
</html>
